<template>
  <div
    class="logo"
    :class="{
      'logo-collapsed': collapsed,
      'logo-top': mode === 'top',
    }"
  >
    <n-avatar
      :size="mode === 'top' ? 32 : collapsed ? 40 : 64"
      :src="logo"
      class="hover-scale transition-all duration-300"
    />
    <h2
      v-if="!collapsed"
      class="gradient-text text-lg font-bold truncate max-w-full"
      :class="{ 'text-base mt-0': mode === 'top' }"
    >
      {{ title }}
    </h2>
  </div>
</template>

<script setup lang="ts">
import { DEFAULT_SETTINGS } from "@/config/settings";
import logo from "@/assets/vue.svg";

interface Props {
  title?: string;
  collapsed?: boolean;
  mode?: "side" | "top" | "mix";
}

withDefaults(defineProps<Props>(), {
  title: DEFAULT_SETTINGS.title,
  collapsed: false,
});
</script>

<style scoped>
.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  transition: all 0.3s;
  height: var(--logo-height);
}

.logo-collapsed {
  padding: 15px 0;
  height: var(--logo-collapsed-height);
}

.logo-top {
  flex-direction: row;
  height: var(--header-height);
  padding: 0;
  gap: 8px;
}

h2 {
  margin: 0;
  white-space: nowrap;
}

.hover-scale:hover {
  transform: scale(1.05);
}

.gradient-text {
  background: linear-gradient(to right, #12c2e9, #c471ed, #f64f59);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
</style>
